<div class="main-container" id="main-container" xmlns:th="http://www.thymeleaf.org">
    <div class="main-container-inner">
        <div class="main-content">
            <div class="page-content">
                <div class="row">
                    <form class="form-horizontal"  role="form" id="update_form" >
                        <input type="hidden" class="form-control" id="uporgCode" name="orgCode" th:attr="value=${id}"/>
                        <input type="hidden" class="form-control" id="upid" name="id"/>
                        <div class="col-md-12">
                            <div class="form-group">
                                <label for="myName" class="col-sm-3 control-label">上级权限</label>
                                <div class="col-sm-7">
                                    <input type="text" class="form-control"
                                           readonly id="myName" name="myName"/>
                                </div>
                            </div>
                            <div class="form-group">
                                <label for="urentCode" class="col-sm-3 control-label">所属客户</label>
                                <div class="col-sm-7">
                                    <select class="form-control" id="urentCode" name="rentCode" >
                                    </select>
                                </div>
                            </div>
                            <div class="form-group">
                                <label for="ufunctionName" class="col-sm-3 control-label">权限名称</label>
                                <div class="col-sm-7">
                                    <input type="text" class="form-control" id="ufunctionName" name="functionName" />
                                </div>
                            </div>
                            <div class="form-group">
                                <label for="ufunctionUrl" class="col-sm-3 control-label">权限地址</label>
                                <div class="col-sm-7">
                                    <input type="text" class="form-control" id="ufunctionUrl" name="functionUrl" />
                                </div>
                            </div>
                            <div class="form-group">
                                <label for="ufunctionType" class="col-sm-3 control-label">请求方式</label>
                                <div class="col-sm-7">
                                    <select class="form-control" id="ufunctionType" name="functionType">
                                        <option value="1">POST</option>
                                        <option value="2">PUT</option>
                                        <option value="3">GET</option>
                                        <option value="4">DELETE</option>
                                    </select>
                                </div>
                            </div>
                    </form>
                </div>
            </div>
        </div>
    </div>
</div>
<script type="text/javascript">
    $(function() {
        ajaxs('./DFunction/searchByCode/' + $('#uporgCode').val(), 'GET', null, true, function (data) {
            $("#myName").val(data.extender.showFunctionFCode);
            $("#ufunctionName").val(data.functionName);
            $("#ufunctionUrl").val(data.functionUrl);
            $("#ufunctionType").val(data.functionType);
            $("#upid").val(data.id);
            ajaxs('./DRent/getRentKeyValue', 'GET', null, true, function (typedata) {
                for (var i = 0; i < typedata.length; i++) {
                    if(typedata[i].key==data.rentCode){
                        $("#urentCode").append("<option selected='selected' value=" + typedata[i].key + ">" + typedata[i].value + "</option>");
                    }else {
                        $("#urentCode").append("<option value=" + typedata[i].key + ">" + typedata[i].value + "</option>")
                    }
                }
            });
        });
    });
    function form_sub() {
        ajaxs('./DFunction', 'PUT',$("#update_form").serialize(), true, function(data){
            $("#im_unique_dlg").modal('hide');
            layer.msg(data.message);
            initTree();
        });
    }
</script>